package org.zjh.common;

import org.zjh.controller.GameController;
import org.zjh.model.Player;
import org.zjh.model.Poker;
import org.zjh.model.RealPlayer;
import org.zjh.utils.PokerUtil;
import org.zjh.view.game.GamePanel;
import org.zjh.view.ui.GameUi;

import javax.swing.*;
import java.util.ArrayList;

/**
 * @description: TODO
 * @author 郑佳豪
 * @date 2024/10/24 14:04
 * @version 1.0
 */
public class GameCommon {

    /**
     * 更新游戏倍数
     * @param pokerArrayList 出牌集合
     */
    public static void checkDiscardBoom(ArrayList<Poker> pokerArrayList) {
        GamePanel gamePanel = GameUi.gameFrame.getGamePanel();
        PokerType pokerType = PokerUtil.judgePokerType(pokerArrayList);


        if (pokerType == PokerType.P4) {
            if (pokerArrayList.size() == 2) {
                gamePanel.setRocketNum(1);
            } else {
                gamePanel.setBoomNum(gamePanel.getBoomNum() + 1);
            }
            JLabel multipleJLabel = gamePanel.getMultipleJLabel();
            int multiple = Integer.parseInt(multipleJLabel.getText().substring(3));
            multipleJLabel.setText("倍数：" + (multiple * 2));
        }
    }



}
